/**
 *  @file SDLInputField.h
 *
 *  @date 23-dec-2009
 *  @author Ives van der Flaas
 */

#ifndef SDLINPUTFIELD_H_
#define SDLINPUTFIELD_H_

#include <SDL.h>
#include <string>
#include <tr1/memory>
#include "SDLTextRepresentation.h"
namespace si_sdl
{
/**
 * Represents a simple inputfield. There can only be one of these at one time. You have to send
 * it all of your events so it knows what to draw.
 */
class SDLInputField
{
public:
	/**
	 * Ctor
	 * @param position Upper left position for the text
	 * @return
	 */
	SDLInputField(si::Vector2 position);
	virtual ~SDLInputField();

	virtual void onSDLEvent(SDL_Event& event);
	virtual void draw() const ;
	void reset() { fContents = ""; }
	std::string getContents() const { return fContents; }

private:
	void updateText();
	si::Vector2 fPosition;
	std::string fContents;
	std::tr1::shared_ptr<SDLTextRepresentation> fMyText;
};

}

#endif /* SDLINPUTFIELD_H_ */
